using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using SqlSugar;
using BasicData.Domain.Entities;
using Process.Domain.Entities;

namespace Produce.Domain.Entities
{
    [SugarTable("production_workorder")]
    public class ProductionWorkorder : BaseEntity
    {
        [SugarColumn(ColumnName = "Code", IsNullable = true)]
        public string? Code { get; set; }

        [SugarColumn(ColumnName = "ProductionType", IsNullable = true)]
        public string? ProductionType { get; set; }

        /// <summary>
        /// 客户  外键引用
        /// </summary>
        [SugarColumn(ColumnName = "Client", IsNullable = true)]
        public long? Client { get; set; }

        [Navigate(NavigateType.OneToOne, nameof(Client))]
        [SugarColumn(IsIgnore = true)]
        public CustomerModel Customer { get; set; }


        /// <summary>
        /// 产品主数据
        /// </summary>
        [SugarColumn(ColumnName = "Masterdata", IsNullable = true)]
        public long? Masterdata { get; set; }
        /// <summary>
        /// 产品物料表
        /// </summary>
        [Navigate(NavigateType.OneToOne, nameof(Masterdata))]
        [SugarColumn(IsIgnore = true)]
        public ProductModel ProductName { get; set; }


        /// <summary>
        /// 产线 （外键）
        /// </summary>
        [SugarColumn(ColumnName = "Line", IsNullable = true)]
        public long? Line { get; set; }
        /// <summary>
        /// 产线工序
        /// </summary>
        [Navigate(NavigateType.OneToOne, nameof(Line))]
        [SugarColumn(IsIgnore = true)]
        public LineModel LineName { get; set; }


        /// <summary>
        /// 工序路线
        /// </summary>
        [SugarColumn(ColumnName = "Operation", IsNullable = true)]
        public long? Operation { get; set; }
        /// <summary>
        /// 工序路线
        /// </summary>
        [Navigate(NavigateType.OneToOne, nameof(Operation))]
        [SugarColumn(IsIgnore = true)]
        public OperationModel OperationName { get; set; }


        [SugarColumn(ColumnName = "State", IsNullable = true)]
        public string? State { get; set; }

        /// <summary>
        /// 生产进度
        /// </summary>
        [SugarColumn(ColumnName = "Progress", IsNullable = true)]
        public string? Progress { get; set; }


        [SugarColumn(ColumnName = "ProductionCount", IsNullable = true)]
        public int? ProductionCount { get; set; }

        [SugarColumn(ColumnName = "BeginTime", IsNullable = true)]
        public DateTime? BeginTime { get; set; }

        [SugarColumn(ColumnName = "EndTime", IsNullable = true)]
        public DateTime? EndTime { get; set; }

        [SugarColumn(ColumnName = "Whether", IsNullable = true)]
        public string? Whether { get; set; }

        [SugarColumn(ColumnName = "Img", IsNullable = true)]
        public string? Img { get; set; }

        [SugarColumn(ColumnName = "ProductionDesc", IsNullable = true)]
        public string? ProductionDesc { get; set; }

        [SugarColumn(ColumnName = "Input", IsNullable = true)]
        public int? Input { get; set; }

        [SugarColumn(ColumnName = "Good", IsNullable = true)]
        public int? Good { get; set; }

        [SugarColumn(ColumnName = "Scrap", IsNullable = true)]
        public int? Scrap { get; set; }

        [SugarColumn(ColumnName = "Source", IsNullable = true)]
        public string? Source { get; set; }

        [SugarColumn(ColumnName = "ProductionNumber", IsNullable = true)]
        public string? ProductionNumber { get; set; }

        [SugarColumn(ColumnName = "WorkflowId", IsNullable = true)]
        public long? WorkflowId { get; set; }

        [SugarColumn(ColumnName = "processstep", IsNullable = true, ColumnDataType = "VARCHAR(2000)")]
        public string? step { get; set; }
    }
}